<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Select</title>

    <script type="text/javascript">
        //<![CDATA[
        function catchEvent(eventObj, event, eventHandler) {
            if (eventObj.addEventListener) {
                eventObj.addEventListener(event, eventHandler, false);
            }
            else if (event.attachEvent) {
                event = "on" + event;
                eventObj.attachEvent(event, eventHandler);
            }
        }

        function cancelEvent(event) {
            if (event.preventDefault) {
                event.preventDefault();
                event.stopPropagation();
            }
            else {
                event.returnValue = false;
                event.cancelBubble = true;
            }
        }

        catchEvent(window, "load", setupEvent);

        function setupEvent(evnt) {
            catchEvent(document.getElementById("someForm"), "submit", validateForm);
        }

        function validateForm(evnt) {
            var theEvent = evnt ? evnt : windows.event;

            var strResult = "";
            var textInputs = document.getElementById("someForm").getElementsByTagName("input");
            for(var i=0; i<textInputs.length; i++) {

                if (textInputs[i].type != "submit") {
                    strResult += textInputs[i].value;
                }
            }
            document.getElementById("text4").value = strResult;

            cancelEvent(theEvent);
        }
        
        //]]>
    </script>
</head>
<body>
    <form id="someForm" action="">
        <p>
            <input type="text" name="text1" /> <br/>
            <input type="password" name="text2" /> <br/>
            <input type="hidden" name="text3" value="hidden value"/>
            <textarea id="text4" cols="50" rows="10">The text area</textarea>
            
            <input type="submit" value="Submit">
        </p>
    </form>
</body>
</html>
